<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<%@include file="../../common/Include_input_head.jsp" %>
	  <script type="text/javascript" src="${basePath}/clientui/js/form/multiselect.js"></script>
    <title>报表新增</title>
    
	<script type="text/javascript">
        detailPageStyle();
	    validate_required_fields = [
			{fieldId:"chartname", message:"报表名称！", mustMatch: true}
		];
		$(function(){
			var applicablerole = $('#applicablerole').val().split(",");
			if (applicablerole.length>0){
				for (i=0;i<applicablerole.length;i++){
					$('#usrtype'+applicablerole[i]).attr("checked", true);
				}
			}
		});
	function submitForm(){	
		if(isValidateForm())
			super_doSave(true);
	}

	function deletePic(){
		var conf = window.confirm("您确定要删除这个图片吗？");
		if (conf == true) {
			var url = actionName + "-removePic." + uri_suffix;
			var wid = '<s:property value="tsysReportfactory.wid"/>';
			$.post(url, { wid : wid, reqtime : (new Date()).getTime() }, function(data) {
				if( data=="ok" ){
					$(".shydtYulan").html("");
				}else{
					alert(data);
				}
			});
		}
	}
	</script>
	<link rel="stylesheet" type="text/css" href="<s:property value="basePath"/>/resources/css/webface.css">
  	<base target="_self">
  </head>
  
<body style="text-align:center;">
  <div class="box1" >
	  <s:form name="theform" method="post" theme="simple" enctype="multipart/form-data">
		<s:hidden name="tsysReportfactory.wid" />
		<s:hidden name="servicestate" value="%{#request.servicestate}"/>
	 	<fieldset> 
		　 <legend>新增报表描述</legend>
		   <table width="100%" border="0" align="center">
		  	<tr>
		  		<td style="text-align: right">数据源：</td>
		  		<td colspan="3">
					<s:select id="code" name="tsysReportfactory.code" list="DBCode" listKey="id" listValue="caption" cssClass="default" autoWidth="true" cssStyle="width:100px" />
					<label style="color:red">*</label>
		  		</td>
				<td rowspan="10">
					<div style="border:1px solid #333">
						<s:if test="tsysReportfactory!=null">
						<iframe allowtransparency="true" frameborder="0" width="100%" height="400" scrolling="no" id="righttop"
								src="${basePath}/s/uc/shd/yl-<s:property value="tsysReportfactory.wid"/>(400)"></iframe>
						</s:if>
					</div>
				</td>
		  	</tr>
		  	<tr>
		  		<td style="width:10%;text-align: right">报表名称：</td>
		  		<td style="width:15%">
					<s:textfield id="chartname" name="tsysReportfactory.chartname" maxlength="150" size="50" />
					<label style="color:red">*</label>
		  		</td>  		
		  	</tr>
		  	<tr>
		  		<td style="width:10%;text-align: right">执行SQL：</td>
		  		<td style="width:15%">
		  			<s:textarea id="querysql" name="tsysReportfactory.querysql" maxlength="350" rows="3" cols="100"  cssClass="default"  cssStyle="width: 390px;"/>
		  		 	<label style="color:red">*</label>
		  		</td>  		
		  	</tr>
			<tr>
				<td style="text-align: right">图表类型：</td>
			    <td colspan="3">
				   <s:select id="charttype" name="tsysReportfactory.charttype" list="getSysCode('chart_type')" listKey="id" listValue="caption" headerKey="" headerValue="----请选择-----" cssClass="default" autoWidth="true" cssStyle="width:100px" />
				   <label style="color:red">*</label>
			   </td>
			</tr>
			<tr>
				   <td style="width:10%;text-align: right">分组条件名称：</td>
				   <td style="width:15%">
					   <s:textfield id="groupingconditions" name="tsysReportfactory.groupingconditions" maxlength="150" size="150" cssStyle="width: 180px;"/>
					   <label style="color:red">*</label>
				   </td>
			</tr>
			<tr>
				   <td style="width:10%;text-align: right">分析项名称：</td>
				   <td style="width:15%">
					   <s:textfield id="analysisofitem" name="tsysReportfactory.analysisofitem" maxlength="150" size="150" cssStyle="width: 180px;"/>
					   <label style="color:red">*</label>
				   </td>
			</tr>
			<tr>
				   <td style="text-align: right">适用人员：</td>
				   <td colspan="3">
					   <s:hidden name="tsysReportfactory.applicablerole" id="applicablerole"></s:hidden>
					   校领导 <input type="checkbox" value="3" name="tsysReportfactory.usrtype" id="usrtype1"/>
					   教师<input type="checkbox" value="1" name="tsysReportfactory.usrtype" id="usrtype2"/>
					   学生<input type="checkbox" value="2" name="tsysReportfactory.usrtype" id="usrtype3"/>
				   </td>
			</tr>
			<tr id="tr_syydt" >
				   <td style="width:10%;text-align: right"><span id="td_syydt">上传图片</span>：</td>
				   <td style="width:15%">
					   <table border="0" cellpadding="0">
						   <tr>
							   <td>
								   <span class="left"><input type="file" name="photo" class="default" /></span>
							   </td>
							   <s:if test="tsysReportfactory.images!=null">
								   <td width="100" class="shydtYulan">
									   <ul class="imgBubble">
										   <li><a href="../${tsysReportfactory.images }" target="_blank"><img id="syydt_img" src="../${tsysReportfactory.images }" alt="点击查看原图" border="1" height="100px;"/></a></li>
									   </ul>
								   </td>
								   <td class="shydtYulan">
									   <a href="javascript:deletePic()" title="删除图片"><img src="../clientui/icons/delete.gif" /> </a>
								   </td>
							   </s:if>
						   </tr>
					   </table>
				   </td>
			   </tr>
		  	<tr>
		  		<td style="width:10%;text-align: right">说明：</td>
		  		<td style="width:15%">
		  			<s:textarea id="shuom" name="tsysReportfactory.shuom" maxlength="150" rows="3" cols="100" cssClass="default"  cssStyle="width: 390px;"/>
		  		</td>  		
		  	</tr>
			 <tr>
				 <td align="right" nowrap="nowrap">是否启用：</td>
				 <td align="left">
			         <s:radio cssClass="validate[required] radio" name="tsysReportfactory.state" list="#{1:'启用', 0:'禁用'}" listKey="key" listValue="value"/>
				     <label style="color:red">*</label></td>
			 </tr>
		   </table>
		</fieldset>
	  </s:form>
  </div>
  <div class="padding_top10">
	<table class="tableStyle" transMode="true">
		<tr>
			<td colspan="4">
				<input type="button" id="ysSaveButton" value=" 保 存 " onclick="submitForm()"/>
				<input type="button" value=" 关 闭 " onclick="parent.closeEntityWindow()"/>
				<s:if test="actionErrors.size()>0 || actionMessages.size()>0 || fieldErrors.size()>0">
						<span id="SystemErrorMessage" style="top: 20px">
							<s:actionerror cssStyle="color:red"/>
							<s:actionmessage cssStyle="color:blue"/>
							<s:fielderror/>
						</span>
				</s:if>
			</td>
		</tr>
	</table>
  </div> 
</body>
</html>
